package com.mariusz.utils;

import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Currency;
import java.util.Date;
import java.util.Locale;

import javax.swing.text.DateFormatter;

public class Formats {

	public static  NumberFormat POUNDS;
	public static NumberFormat CASH;
	public static NumberFormat NUMBER;
	private static DateFormat dateFormat = SimpleDateFormat.getDateInstance();
	private static DateFormat dateCossyFormat = new SimpleDateFormat("EEEEE, d MMMMM yyyy ",Locale.UK);

	static{
		POUNDS = NumberFormat.getCurrencyInstance(Locale.UK);
		CASH = NumberFormat.getInstance();
		NUMBER = NumberFormat.getIntegerInstance();
		CASH.setGroupingUsed(true);
		CASH.setRoundingMode(RoundingMode.HALF_UP);
		CASH.setMaximumFractionDigits(2);
		CASH.setMinimumFractionDigits(2);
	
	}
	
	public static synchronized String formatDate(Date date){
		return dateFormat.format(date);
	}
	
	public static synchronized String formatCossyDate(Date date){
		return dateCossyFormat.format(date);
	}
	
	public static synchronized String formatPounds(Double d){
		return POUNDS.format(d);
	}
}
